﻿﻿<!DOCTYPE html>
<html>
<head>
<title>登录注册</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />


<link href="css/loginstyle.css" rel="stylesheet" type="text/css" media="all" />

<script src="js/jquery.min.js"></script>
<script src="js/easyResponsiveTabs.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
$('#horizontalTab').easyResponsiveTabs({
		type: 'default',
		width: 'auto',
		fit: true
	});
});
</script>

</head>
<body>


<div class="main-info">

	<div class="sap_tabs">

		<div id="horizontalTab" style="display: block; width: 100%; margin: 0px;">

			<ul class="resp-tabs-list">
				<li class="resp-tab-item" aria-controls="tab_item-0" role="tab"><h2><span>登录</span></h2></li>
				<li class="resp-tab-item" aria-controls="tab_item-1" role="tab"><span>注册</span></li>
				<div class="clear"> </div>
			</ul>

			<div class="resp-tabs-container">

				<div class="tab-1 resp-tab-content" aria-labelledby="tab_item-0">
					<div class="login-top">
						<div id="login">
							<input type="text" class="email" placeholder="账号" name="account" id="account" required="" />
							<input type="password" class="password" placeholder="密码" name="pwd" id="pwd" required="" />
							<input type="checkbox" id="brand" value="">
							<label for="brand"><span></span>记住我</label>
						</div>
						<div class="login-bottom">
							<ul>
								<li>
									<a href="../web-view/forgetPwd1.html">忘记密码？</a>
								</li>
								<li>
									<form>
										<input type="button" onclick="loginSubmit()" value="登录"/>
									</form>
								</li>
							<ul>
							<div class="clear"></div>
						</div>
					</div>
				</div>

				<div class="tab-1 resp-tab-content" aria-labelledby="tab_item-1">
					<div class="login-top sign-top">
						<div id="register">
							<input type="text" class="name active" placeholder="用户名" required="" id="account1" name="account"/>
							<input type="text" class="email" placeholder="手机号" required="" id="phone" name="phone"/>
							<input type="password" class="password" placeholder="密码" required=""id="pwd1" name="pwd"/>
							<input type="checkbox" id="brand1" value="">
							<label for="brand1"><span></span> 记住我</label>
						</div>
						<div class="login-bottom">
							<ul>
								<li>
									<a href="/#">忘记密码</a>
								</li>
								<li>
									<form>
										<input type="button" value="注册" onclick="RegisterSubmit()"/>
									</form>
								</li>
							<ul>
							<div class="clear"></div>
						</div>
					</div>
				</div>

			</div>
		</div>

	</div>

	<div class="social-icons">
		<ul>
			<li><a href="/#"><span class="icons"></span><span class="text">Facebook</span></a></li>
			<li class="twt"><a href="/#"><span class="icons"></span><span class="text">Twitter</span></a></li>
			<li class="ggp"><a href="/#"><span class="icons"></span><span class="text">Google+</span></a></li>
			<li class="pin"><a href="/#"><span class="icons"></span><span class="text">Pinterest</span></a></li>
			<div class="clear"> </div>
		</ul>
	</div>

</div>
<script>
    function loginSubmit() {
        var account = $("#account").val();    // 获取id为username1的<input>框数据
        var pwd = $("#pwd").val();    // 获取id为password1的<input>框数据
		$.post("/web-user/user/login",{"account":account,"pwd":pwd}, function (resoult) {
		    if(resoult=="success"){
                alert("登陆成功");
                location.href="../web-view/index.html"
            }else if(resoult=="success1"){
                alert("登陆成功");
                location.href="../web-view/frame.html"
			}
            else {
                alert("登陆失败");
			}

        });
    };

    function RegisterSubmit() {
        var account = $("#account1").val();    // 获取id为username的<input>框数据
        var pwd = $("#pwd1").val();    // 获取id为password的<input>框数据
		var phone = $('#phone').val();  //获取id为phone的<input>数据
        $.post("/web-user/user/register",{"account":account,"pwd":pwd,"phone":phone}, function (resoult) {
            alert("注册成功");
            location.href="http://localhost:8131/index.html"
        });
    }
</script>

</body>
</html>
